package com.zhangjingcheng.yunyixia.util;

public class ThreadLocalUtil {

    private static final ThreadLocal<Integer> USER_ID = new ThreadLocal<>();

    /**
     * 设置用户ID
     *
     * @param id
     */
    public static void setId(Integer id) {
        USER_ID.set(id);
    }

    /**
     * 获取用户ID
     *
     * @return
     */
    public static Integer getId() {
        return USER_ID.get();
    }

    /**
     * 删除用户ID
     */
    public static void remove() {
        USER_ID.remove();
    }
}
